
@extends('.web.layout')

@section('title','首页')
@section('head')
    <link href="/code/css/base.css" rel="stylesheet" />
    <link href="/code/css/index.css" rel="stylesheet" />
@endsection
@section('content')
    @include('.web.partial.foot-tab',['active'=>'首页'])

    <div class="mui-content">

        <div id="slider" class="mui-slider">
            <div class="mui-slider-group mui-slider-loop">
                @if($banners)
                    @php
                        $last = count($banners)-1;
                    @endphp
                    <div class="mui-slider-item mui-slider-item-duplicate">
                        <a href="{{$banners[$last]['link']}}">
                            <img src="{{asset('storage/'.$banners[$last]['img'])}}">
                        </a>
                    </div>
                @endif
                @foreach($banners as $banner)
                        <div class="mui-slider-item">
                            <a href="{{$banner['link']}}">
                                <img src="{{asset('storage/'.$banner['img'])}}">
                            </a>
                        </div>
                @endforeach
                @if($banners)
                        <div class="mui-slider-item mui-slider-item-duplicate">
                            <a href="{{$banners[0]['link']}}">
                                <img src="{{asset('storage/'.$banners[0]['img'])}}">
                            </a>
                        </div>
                @endif

            </div>
            <div class="mui-slider-indicator">
                @foreach($banners as $banner)
                    @if($loop->first)
                        <div class="mui-indicator mui-active"></div>
                    @else
                        <div class="mui-indicator"></div>
                    @endif
                @endforeach

            </div>
        </div>
        <!--end banner-->
        <!--通知-->
        @if($tzgg)
        <div class="inform" style="display: none">
            <img src="/code/images/notice.png" style="width: 55px;">
                <a href="{{route('wap.post-index',['id'=>$tzgg[0]['id']])}}">
                    <p>{{$tzgg?$tzgg[0]['post_title']:''}}</p>
                </a>
                <a href="{{route('wap.post-list',['slug'=>'tzgg'])}}">
                    <img src="/code/images/next.png" class="next_icon" />
                </a>
        </div>
        @endif

        <!--icon-->
        <div class="iconTab">
            @foreach(\App\Nav::getMenu('主菜单') as $nav)
                <div class="icon">
                    @if($nav['type']==2)
                        <a href="{{route('wap.post-list',['slug'=>$nav['link']])}}" >
                            @endif
                            <img src="{{asset($nav['icon'])}}" />
                            <span>{{$nav['name']}}</span>
                        </a>
                </div>
            @endforeach
        </div>

        <!--新闻-->
        <div class="recommend">
            <div class="top">
                <a href="{{route('wap.post-list',['slug'=>'xwdt'])}}" style="color:#666">
                    最新新闻<img src="/code/images/next.png" class="next_icon" style="top: 10px;" />

                </a>
            </div>
            <ul class="mui-table-view ">
                @if(!$xwdt)
                    <p>暂无新闻</p>
                @else
                    @foreach($xwdt as $k=>$v)
                        <li class="mui-table-view-cell mui-media">
                            <a href="{{route('wap.post-index',['id'=>$v['id']])}}">
                                @if($v['thumb'])
                                    <img class="mui-media-object mui-pull-right" src="{{asset('storage/'.$v['thumb'])}}" />
                                @endif
                                <div class="mui-media-body">
                                    <div class="mui-ellipsis list_title">{{$v['post_title']}}</div>
                                </div>
                            </a>
                        </li>
                    @endforeach
                @endif

            </ul>
        </div>
        <!--end-->
    </div>
@endsection
@section('foot')
    <script>
        var gallery = mui('.mui-slider');
        gallery.slider({
            interval:5000//自动轮播周期，若为0则不自动播放，默认为0；
        });
    </script>
@endsection